package com.yuufa;

import java.io.File;

public class FileTest {
    
    public static void main(String[] args) throws Exception {
        
        int sp = -1;
        File[] files = new File[10000];
        
        String path = "e:\\facebook1";
        String sourcePath = "e:\\facebook";
        File source = new File(sourcePath);
        
        files[++sp] = source;
        
        while(sp != -1) {
            File top = files[sp--];
            
            String newPath = path + top.getAbsolutePath().substring(sourcePath.length());
            System.out.println(newPath);
            new File(newPath).mkdir();

            File[] subs = top.listFiles();
            for(int i=0;i<subs.length;i++) {
                if(subs[i].isDirectory()) {
                    sp++;
                    files[sp] = subs[i];
                }
            }
        }
        
    }

}
